package com.demo.heima;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.locks.LockSupport;

/**
 * @author lkz
 * @className LockSupportPark
 * @description 线程阻塞
 * @date 2024/6/11 15:38
 **/
@Slf4j
public class LockSupportPark {

    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            log.info("t1 start");
            LockSupport.park();
            log.info("t1 end");
        }, "t1");
        t1.start();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
       // LockSupport.unpark(t1);
        t1.interrupt();

    }


}


